package optionshandler

import (
	"github.com/gin-gonic/gin"
	"yundian/internel/app/dao"
	"yundian/internel/app/helper/request"
	"yundian/internel/pkg/dingo"
)

func BrokerageOptions(ctx *gin.Context) {
	// 请求参数处理
	param := &request.OptionsInsertReq{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()

	dao.NewOptionsDao().UpdateOptions("partnerBrokerage", param.PartnerBrokerage)           // partnerBrokerage 提现手续费：
	dao.NewOptionsDao().UpdateOptions("minMoneyStr", param.MinMoneyStr)                     // 提现金额：minMoneyStr   maxMoneyStr
	dao.NewOptionsDao().UpdateOptions("maxMoneyStr", param.MaxMoneyStr)                     // 提现金额：minMoneyStr   maxMoneyStr
	dao.NewOptionsDao().UpdateOptions("projectDayMaxMoneyStr", param.ProjectDayMaxMoneyStr) // 项目日限额：projectDayMaxMoneyStr
	dao.NewOptionsDao().UpdateOptions("dayMaxMoneyStr", param.DayMaxMoneyStr)               // 代理商日限额：dayMaxMoneyStr
	dao.NewOptionsDao().UpdateOptions("autoMaxMoneyStr", param.AutoMaxMoneyStr)             //自动审核金额： autoMaxMoneyStr
	dao.NewOptionsDao().UpdateOptions("aliTransferAppId", param.AliTransferAppId)           //支付宝转账appId:  aliTransferAppId
	dao.NewOptionsDao().UpdateOptions("wxTransferAppId", param.WxTransferAppId)             //微信转账appId:    wxTransferAppId
	dao.NewOptionsDao().UpdateOptions("autoTransferAccounts", param.AutoTransferAccounts)   // 开启自动转账   autoTransferAccounts
}
